package com.yc.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yc.entity.Department;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @program: x-admin
 * @description:
 * @author: Richard
 * @create: 2022-05-02 18:55
 */
@Mapper
public interface DepartmentMapper extends BaseMapper<Department> {

    /**
     * 查该用户所在的学院名
     *
     * @return
     */
    @Select("select udName from department where udId=#{udid}")
    List<String> selectDeptNameByUdid(Long udid);

    /**
     * 根据学院名查询id
     *
     * @param udName
     * @return
     */
    @Select("select udId from department where udName=#{udName}")
    Long selectIdByUdName(String udName);

    /**
     * 查询所有学院信息
     * @return
     */
    @Select("select udId,udName from department order by udId DESC")
    List<Department> showAll();


    /**
     * 查询所有学院信息
     * @return
     */
    @Select(" select udId,udName from department ")
    List<Department> queryAllUniversityDepartmentInfo();

}
